package com.cloudeasy.label.authorize;

import com.cloudeasy.core.authorize.AuthorizeConfigProvider;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.stereotype.Component;

/**
 * 用户授权配置提供者
 */
@Component
@Order(Integer.MIN_VALUE)
public class LabelAuthorizeConfigProvier implements AuthorizeConfigProvider {
    @Override
    public void config(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry config) {
        config.antMatchers(HttpMethod.GET,
                "/",
                "/{page}/{size}",

                "/attention/{id}",
                "/attention/{id}/{page}/{size}",
                "/attention/user/{userId}"
        )
                .permitAll();
    }
}
